extends Control

# 标记各个组高亮状态
var kind_switch = {
	"标识符": true,
	"符号": true,
}

# 高亮kind_name组，置灰其他组，保证只有一组高亮
func kind_toggle(kind_name, on):
	for k in kind_switch:
		if k == kind_name:
			kind_switch[k] = on
		else:
			kind_switch[k] = !on
		group_focus(k, kind_switch[k])

func group_focus(kind_name, on):
	# 按组设置颜色
	var color = Color("#ffffff") if on else Color("#6c6c6c")
	get_tree().set_group(kind_name, "self_modulate", color)


func _ready():
	$func_desc.visible = false
	# 设置动画播放器，当前动画名称为 func_intro1
	$AnimationPlayer.current_animation = "func_intro1"
	# 使用手动模式，用 advance() 播放动画帧
	$AnimationPlayer.playback_process_mode = AnimationPlayer.ANIMATION_PROCESS_MANUAL


# 使用按钮控制动画切换，如同PPT切换
var step_index = 0
# 移动播放位置 append delta
var steps = [0.1, 1]
func _on_Button_button_up():
	# 超过动画时间轴，重置位置为初始值
	if step_index >= len(steps):
		step_index = 0
		$AnimationPlayer.advance(-$AnimationPlayer.current_animation_position)
		
	$AnimationPlayer.advance(steps[step_index])
	step_index += 1

